package gp;

import java.util.List;

import firing.FiringTree;



public class GreedyOverSelection implements SelectionStrategy, IndexSelectionStrategy {

    @Override
    public int getIndex(int populationSize) {
	if (Math.random() < .5) { //select from top 20%
		return (int)(4 + Math.random() * populationSize / 5 );
	    } else { //select from bottom 80%
		return (int)(Math.random()*.8*populationSize);
	    }
    }
    public String toString() {
	return "Greedy Over-selection";
    }
    @Override
    public List<FiringTree> getNextGen(List<FiringTree> prevGen) {
	return Generationator.getNextGen(prevGen, this);
    }
}
